<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="js/angular.min.js"></script>
</head>

<body>
    <div ng-app="app">
        <template-directive></template-directive>
    </div>
    <script>
        angular.module('app', []).directive('templateDirective', [function ($cope) {
            return {
                restrict: "E",
                //template: 'first name:{{name}}',//值为string、function 用于显示dom元素
                templateUrl: "template.html"
            }
        }])

        // var app = angular.module("app", []);
        // app.directive("template", function () {
        //     return {
        //         restrict: "EA",
        //         template: "<h1>自定义指令</h1>"
        //     }
        // })

        // angular.module('app', []).directive('zl1', [function () {
        //     return {
        //         restrict: 'AE',
        //         template: 'directive',
        //         link: function ($scope, elm, attr, controller) {
        //             console.log("这是link");
        //         },
        //         controller: function ($scope, $element, $attrs) {
        //             console.log("这是con");
        //         }
        //     };
        // }]).controller('con1', ['$scope', function ($scope) {
        //     $scope.name = "aliceqqq";
        // }]);

    </script>
</body>

</html>